												<div>
												<table id="sample-table-2" class="table table-striped table-bordered table-hover dataTable" aria-describedby="sample-table-2_info">
													<thead>
														<tr role="row">
															<th class="sorting_disabled" role="columnheader" style="width: 12%;"></th>
															<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" style="width: 8%;">Ngày HĐ</th>
															<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" style="width: 11%;">Số hợp đồng</th>
															<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" style="width: 24%;">Tên công ty</th>
															<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" style="width: 10%;">MST</th>
															<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" style="width: 26%;">Địa chỉ</th>
															<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample-table-2" style="width: 10%;">Tình trạng</th>
														</tr>
													</thead>
													<tbody role="alert" aria-live="polite" aria-relevant="all">
														{if $contract_total > 0}
														{section name=contract loop=$contract}
														<tr>
															<td>
																<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
																	<a style="cursor:pointer" class="blue" id="view_{$contract[contract][0]}">
																		<i class="icon-zoom-in bigger-130"></i>
																	</a>
																	<a style="cursor:pointer" class="orange" href="contract?do=add&id={$contract[contract][0]}" onclick="return copy_{$contract[contract][0]}();">
																		<i class="icon-copy bigger-130"></i>
																	</a>
																	<a style="cursor:pointer" class="green" id="edit_{$contract[contract][0]}">
																		<i class="icon-pencil bigger-130"></i>
																	</a>
																	<a style="cursor:pointer" class="red" id="delete_{$contract[contract][0]}">
																		<i class="icon-trash bigger-130"></i>
																	</a>
																</div>

																<div class="visible-xs visible-sm hidden-md hidden-lg">
																	<div class="inline position-relative">
																		<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
																			<i class="icon-caret-down icon-only bigger-120"></i>
																		</button>
																		<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																			<li>
																				<a id="view_{$contract[contract][0]}" class="tooltip-info" data-rel="tooltip" title="" data-original-title="View">
																					<span class="blue">
																						<i class="icon-zoom-in bigger-120"></i>
																					</span>
																				</a>
																			</li>

																			<li>
																				<a id="edit_{$contract[contract][0]}" class="tooltip-success" data-rel="tooltip" title="" data-original-title="Edit">
																					<span class="green">
																						<i class="icon-edit bigger-120"></i>
																					</span>
																				</a>
																			</li>

																			<li>
																				<a href="contract?do=add&id={$contract[contract][0]}" onclick="return copy_{$contract[contract][0]}();" class="tooltip-success" data-rel="tooltip" title="" data-original-title="Copy">
																					<span class="orange">
																						<i class="icon-copy bigger-120"></i>
																					</span>
																				</a>
																			</li>

																			<li>
																				<a id="delete_{$contract[contract][0]}" class="tooltip-error" data-rel="tooltip" title="" data-original-title="Delete">
																					<span class="red">
																						<i class="icon-trash bigger-120"></i>
																					</span>
																				</a>
																			</li>
																		</ul>
																	</div>
																</div>
															</td>

															<td align="center">{$contract[contract][6]}</td>
															<td>{$contract[contract][7]}</td>
															<td><a id="nview_{$contract[contract][0]}" style="cursor:pointer">{$contract[contract][1]}</a></td>
															<td>
															<a href="http://gdt.gov.vn/wps/portal/!ut/p/b1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOINTCw9fSzCgv2dzLxdDTxDHV2NLAM8jC3CzPQLsh0VAVXv_MU!/?mst={$contract[contract][2]}&action=action&id=&page=1" target="_blank">{$contract[contract][2]}</a></td>
															<td>{$contract[contract][3]}</td>
															<td id="display_status1_{$contract[contract][0]}">
															<span style="cursor:pointer;" id="status1_{$contract[contract][0]}" class="{$contract[contract][18]}">{$contract[contract][17]}</span>
															<script>
																$("#status1_{$contract[contract][0]}").click(function(){
																	$.ajax({
																		url: 'ajax?get=contract&do=status',
																		data: 'id={$contract[contract][0]}',
																		type: "POST",
																		success: function(json) {
																			$("#display_status1_{$contract[contract][0]}").load('ajax?get=contract&do=status&id={$contract[contract][0]}&display=1').hide().fadeIn("slow");
																			$("#display_status2_{$contract[contract][0]}").load('ajax?get=contract&do=status&id={$contract[contract][0]}&display=2').hide().fadeIn("slow");
																		}
																	});
																});
															</script>
															</td>
														</tr>
														<script language="JavaScript" type="text/javascript">
															function copy_{$contract[contract][0]}()
															{
																var r = confirm('Sao chép hợp đồng này?');
																if(r){
																	return true;
																} else {
																	return false;
																}
															}
														</script>
														{/section}
														{/if}
													</tbody>
												</table>
												<div class="row">
													<div class="col-sm-6">
														<div class="dataTables_info" id="sample-table-2_info">{if $contract_total > 0}Đang xem từ {$contract_from} đến {$contract_to} trong tổng {$contract_total} hợp đồng{else}Không có bản ghi nào{/if}</div>
													</div>
													{if $contract_total > 0}
													<div class="col-sm-6">
														<div class="dataTables_paginate paging_bootstrap">
															<ul class="pagination">
																<li class="prev {if $contract_page_curr == 1}disabled{/if}">
																	<a {if $contract_page_curr != 1}href="contract?do=list&page={$contract_page_prev}{if $search != ''}&search={$search}{/if}"{/if}><i class="icon-double-angle-left"></i></a>
																</li>
																{section name=contract_page loop=$contract_page}
																<li {if $contract_page_curr == $contract_page[contract_page]}class="active"{/if}>
																	<a href="contract?do=list&page={$contract_page[contract_page]}{if $search != ''}&search={$search}{/if}">{$contract_page[contract_page]}</a>
																</li>
																{/section}
																<li class="next {if $contract_page_curr == $contract_page_end}disabled{/if}">
																	<a {if $contract_page_curr != $contract_page_end}href="contract?do=list&page={$contract_page_next}{if $search != ''}&search={$search}{/if}"{/if}><i class="icon-double-angle-right"></i></a>
																</li>
															</ul>
														</div>
													</div>
													{/if}
												</div>
												</div>
												{section name=contract loop=$contract}
												<div id="dialog_view_{$contract[contract][0]}" style="display:none;" title='Xem chi tiết "{$contract[contract][1]}"'>
													<table class="EditTable" cellspacing="1" align="center" cellpadding="2" border="0" style="table-layout:fixed;width:470px;">
														<tbody>
															<tr></tr>
															<tr>
																<td width="40%"><span>Ngày hợp đồng:</span></td>
																<td><b>{$contract[contract][6]}</b></td>
															</tr>
															<tr>
																<td><span>Số hợp đồng:</span></td>
																<td><b>{$contract[contract][7]}</b></td>
															</tr>
															<tr>
																<td><span>Người đại diện:</span></td>
																<td><b>{$contract[contract][4]}</b></td>
															</tr>
															<tr>
																<td><span>Chức vụ:</span></td>
																<td><b>{$contract[contract][5]}</b></td>
															</tr>
															<tr>
																<td><span>Trạng thái:</span></td>
																<td id="display_status2_{$contract[contract][0]}">
																<span style="cursor:pointer;" id="status2_{$contract[contract][0]}" class="{$contract[contract][18]}">{$contract[contract][17]}</span>
																<script>
																	$("#status2_{$contract[contract][0]}").click(function(){
																		$.ajax({
																			url: 'ajax?get=contract&do=status',
																			data: 'id={$contract[contract][0]}',
																			type: "POST",
																			success: function(json) {
																				$("#display_status2_{$contract[contract][0]}").load('ajax?get=contract&do=status&id={$contract[contract][0]}&display=2').hide().fadeIn("slow");
																			}
																		});
																	});
																</script>
																</td>
															</tr>
															<tr>
																<td><span>Ngày biên bản:</span></td>
																<td>
																	<div class="input-group" style="width:150px">
																		<input class="form-control" id="datebb_{$contract[contract][0]}" value="{$contract[contract][10]}" name="datebb" data-date-format="dd/mm/yyyy">
																		<span class="input-group-addon">
																			<i class="icon-calendar bigger-110"></i>
																		</span>
																	</div>
																</td>
															</tr>
															<tr>
																<td colspan="2">{if $contract[contract][15] != ''}<span>NVKD: <b>{$contract[contract][15]}</b> - {/if}Người nhập cuối: <b>{$contract[contract][9]}</b> - Ngày nhập cuối: <b>{$contract[contract][8]}</b></span></td>
															</tr>
															{if $contract[contract][16] != ''}
															<tr>
																<td colspan="2">Ghi chú: <b>{$contract[contract][16]}</b></td>
															</tr>
															{/if}
														</tbody>
													</table>
													<br>
													<table border="0" class="table table-striped table-bordered table-hover dataTable">
														<thead>
															<tr>
															</tr>
															<tr>
																<td align="center">STT</td>
																<td align="center">Tên sản phẩm, hàng hóa</td>
																<td align="center">Quy cách</td>
																<td align="center">Đơn vị tính</td>
																<td align="center">Số lượng</td>
																<td align="center">Đơn giá</td>
																<td align="center">Thành tiền</td>
															</tr>
														</thead>
														<tbody valign="middle">
															<tr>
															</tr>
															{section name=product loop=$product}
															{if $product[product][1] == $contract[contract][0]}
															<tr>
																<td align="center"><b>{$product[product][0]}</b></td>
																<td align="left">
																	<b>{$product[product][6]} {$product[product][7]} liên</b><br>
																	+ Mẫu số: <b>{$product[product][2]}</b><br>
																	+ Ký hiệu: <b>{$product[product][3]}</b><br>
																	+ Số: <b>{$product[product][15]} - {$product[product][16]}</b>
																</td>
																<td align="left">
																	- Số màu: <b>{$product[product][9]} màu</b><br>
																	- Ruột: <b>{$product[product][10]}</b><br>
																	- Kích thước: <b>{$product[product][11]}</b><br>
																	- Chống ký: {if $product[product][12] == 1}<b>Có</b>{else}<b>Không</b>{/if}
																</td>
																<td align="center"><b>{$product[product][5]}</b></td>
																<td align="center"><b>{$product[product][4]}</b></td>
																<td align="right"><b>{$product[product][8]}</b></td>
																<td align="right"><b>{$product[product][21]}</b></td>
															</tr>
															{/if}
															{/section}
															{section name=product_money loop=$product_money}
															{if $product_money[product_money][0] == $contract[contract][0]}
															<tr>
																<td colspan="6" align="right">Cộng tiền hàng:</td>
																<td align="right"><b>{$product_money[product_money][1]}</b></td>
															</tr>
															<tr>
																<td colspan="6" align="right">Thuế GTGT 10%:</td>
																<td align="right"><b>{$product_money[product_money][2]}</b></td>
															</tr>
															<tr>
																<td colspan="6" align="right">Tổng tiền thanh toán:</td>
																<td align="right"><b>{$product_money[product_money][3]}</b></td>
															</tr>
															<tr>
																<td align="center" colspan="7">Số tiền viết bằng chữ: <b>{$product_money[product_money][4]} Đồng!</b></td>
															</tr>
															{/if}
															{/section}
															<tr>
															</tr>
															<tr>
																<td align="center" colspan="7">
																	<input class="btn btn-sm btn-primary" id="btnhopdong" type="button" name="hopdong" value="Hợp Đồng" onClick="window.open('print?do=hopdong&id={$contract[contract][0]}&pdf')">&nbsp;&nbsp;
																	<input class="btn btn-sm btn-primary" type="button" name="thanhly" value="Thanh Lý" onClick="window.open('print?do=thanhly&id={$contract[contract][0]}&pdf')">&nbsp;&nbsp;
																	<input class="btn btn-sm btn-primary" type="button" name="bangiao" value="Bàn Giao" onClick="window.open('print?do=bangiao&id={$contract[contract][0]}&pdf')">&nbsp;&nbsp;
																	<input class="btn btn-sm btn-primary" type="button" name="kiemtra" value="Kiểm Tra" onClick="window.open('print?do=kiemtra&id={$contract[contract][0]}&pdf')">&nbsp;&nbsp;
																	<input class="btn btn-sm btn-primary" type="button" name="niemphong" value="Niêm Phong" onClick="window.open('print?do=niemphong&id={$contract[contract][0]}&pdf')">&nbsp;&nbsp;
																	<input class="btn btn-sm btn-primary" type="button" name="huy" value="Hủy" onClick="window.open('print?do=huy&id={$contract[contract][0]}&pdf')">&nbsp;&nbsp;
																	<input class="btn btn-sm btn-primary" type="button" name="phieuthu" value="Phiếu Thu" onClick="window.open('print?do=phieuthu&id={$contract[contract][0]}&pdf')">
																</td>
															</tr>
														</tbody>
													</table>
												</div>
												<div id="dialog_edit_{$contract[contract][0]}" style="display:none;" title='Sửa "{$contract[contract][1]}"'>
													<form id="form_edit_{$contract[contract][0]}" method="POST">
													<input type="hidden" name="id" value="{$contract[contract][0]}">
													<table class="EditTable" cellspacing="1" align="center" cellpadding="2" border="0" style="table-layout:fixed;width:75%;">
														<tbody>
															<tr></tr>
															<tr>
																<td width="15%"><label for="name_{$contract[contract][0]}">Tên công ty:</label></td>
																<td width="85%" colspan="3"><input id="name_{$contract[contract][0]}" type="text" name="name" value="{$contract[contract][1]}" size="90"></td>
															</tr>
															<tr>
																<td><label for="address_{$contract[contract][0]}">Địa chỉ:</label></td>
																<td colspan="3"><input id="address_{$contract[contract][0]}" type="text" name="address" value="{$contract[contract][3]}" size="90"></td>
															</tr>
															<tr>
																<td><label for="tax_{$contract[contract][0]}">Mã số thuế:</label></td>
																<td><input type="text" name="tax" value="{$contract[contract][2]}" id="tax_{$contract[contract][0]}" data-mask="0000000000-000" size="25"></td>
																<td width="15%" align="right"><label for="contract_{$contract[contract][0]}">Số hợp đồng:</label></td>
																<td width="35%"><input id="contract_{$contract[contract][0]}" type="text" name="contract" value="{$contract[contract][7]}" size="24"></td>
															</tr>
															<tr>
																<td><label for="director_{$contract[contract][0]}">Người đại diện:</label></td>
																<td><input id="director_{$contract[contract][0]}" type="text" name="director" value="{$contract[contract][4]}" size="25"></td>
																<td width="15%" align="right"><label for="date_{$contract[contract][0]}">Ngày hợp đồng:</span></td>
																<td width="35%"><div class="input-group" style="width:150px">
																		<input class="form-control" id="date_{$contract[contract][0]}" value="{$contract[contract][6]}" name="date" data-date-format="dd-mm-yyyy">
																		<span class="input-group-addon">
																			<i class="icon-calendar bigger-110"></i>
																		</span>
																	</div>
																</td>
															</tr>
															<tr>
																<td><label for="position_{$contract[contract][0]}">Chức vụ:</label></td>
																<td><input id="position_{$contract[contract][0]}" type="text" name="position" value="{$contract[contract][5]}" size="25"></td>
																<td align="right"><label for="tamung_{$contract[contract][0]}">Tạm ứng:</label></td>
																<td><input id="tamung_{$contract[contract][0]}" type="text" name="tamung" class="money" value="{$contract[contract][13]}" size="24"></td>
															</tr>
															<tr>
																<td><label for="marketing_{$contract[contract][0]}">NV kinh doanh:</label></td>
																<td><input id="marketing_{$contract[contract][0]}" type="text" name="marketing" value="{$contract[contract][15]}" size="25"></td>
																<td align="right"><label for="ngaygiao_{$contract[contract][0]}">Giao hàng sau:</label></td>
																<td><input id="ngaygiao_{$contract[contract][0]}" type="text" name="ngaygiao" value="{$contract[contract][14]}" size="15"> ngày</td>
															</tr>
															<tr>
																<td><label for="note_{$contract[contract][0]}">Ghi chú:</label></td>
																<td colspan="3"><input id="note_{$contract[contract][0]}" type="text" name="note" value="{$contract[contract][16]}" size="90"></td>
															</tr>
															<tr>
																<td><span>Niêm phong:</span></td>
																<td colspan="3"><label><input id="niemphong_{$contract[contract][0]}" type="checkbox" name="niemphong" value="1" {if $contract[contract][12] == 1}checked>{else}><input type="hidden" name="niemphong" id="niemphong_hidden_{$contract[contract][0]}" value="0">{/if} <em>(Nếu niêm phong thì số hủy và bản hủy bằng 0)</em></label></td>
															</tr>
														</tbody>
													</table>
													<br>
													<table border="0" id="addtable_{$contract[contract][0]}" class="table table-striped table-bordered table-hover dataTable">
														<thead>
															<tr>
															</tr>
															<tr>
																<td align="center">STT</td>
																<td align="center">Tên sản phẩm, hàng hóa</td>
																<td align="center">Quy cách</td>
																<td align="center">Đơn vị tính</td>
																<td align="center">Số lượng</td>
																<td align="center">Từ số</td>
																<td align="center">Đến số</td>
																<td align="center">Đơn giá</td>
															</tr>
														</thead>
														<tbody valign="middle">
															<tr>
															</tr>
															{section name=product loop=$product}
															{if $product[product][1] == $contract[contract][0]}
															<tr id="tr_{$contract[contract][0]}">
																<td align="center"><b>{$product[product][0]}</b></td>
																<td align="left">
																	<span class="inline">
																		Sản phẩm: <input type="text" id="product_name_{$product[product][0]}_{$contract[contract][0]}" name="product_name[]" value="{$product[product][6]}" size="35">
																		<select name="product_page[]">
																			{for $foo=1 to 10}
																			<option value="{$foo}" {if $product[product][7] == $foo}selected{/if}>{$foo}</option>
																			{/for}
																		</select> liên
																	</span>
																	<br>
																	<span class="inline">Mẫu số: <input id="form_{$product[product][0]}_{$contract[contract][0]}" type="text" name="form[]" value="{$product[product][2]}" size="15"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																	<span class="inline">Ký hiệu: <input id="serial_{$product[product][0]}_{$contract[contract][0]}" type="text" name="serial[]" value="{$product[product][3]}" size="15"></span><br>
																	<span class="inline">Logo: <label id="logo_lbl_{$product[product][0]}_{$contract[contract][0]}"><input class="ace ace-switch ace-switch-3" type="checkbox" value="1" name="logo[]" id="logo_{$product[product][0]}_{$contract[contract][0]}" {if $product[product][18] == 1}checked{/if}/> <span class="lbl"></span></label>{if $product[product][18] == 0}<input type="hidden" id="logo_hidden_{$product[product][0]}_{$contract[contract][0]}" name="logo[]" value="0" />{/if}</span>
																	<span class="inline">Hoa văn: <label id="hoavan_lbl_{$product[product][0]}_{$contract[contract][0]}"><input class="ace ace-switch ace-switch-3" type="checkbox" value="1" name="hoavan[]" id="hoavan_{$product[product][0]}_{$contract[contract][0]}" {if $product[product][17] == 1}checked{/if}/> <span class="lbl"></span></label>{if $product[product][17] == 0}<input type="hidden" id="hoavan_hidden_{$product[product][0]}_{$contract[contract][0]}" name="hoavan[]" value="0" />{/if}</span>
																	<span class="inline">Chống ký: <label id="signed_lbl_{$product[product][0]}_{$contract[contract][0]}"><input class="ace ace-switch ace-switch-3" type="checkbox" value="1" name="signed[]" id="signed_{$product[product][0]}_{$contract[contract][0]}" {if $product[product][12] == 1}checked{/if}/> <span class="lbl"></span></label>{if $product[product][12] == 0}<input type="hidden" id="signed_hidden_{$product[product][0]}_{$contract[contract][0]}" name="signed[]" value="0" />{/if}</span>
																	<span class="inline">Mật mã: <label id="matma_lbl_{$product[product][0]}_{$contract[contract][0]}"><input class="ace ace-switch ace-switch-3" type="checkbox" value="1" name="matma[]" id="matma_{$product[product][0]}_{$contract[contract][0]}" {if $product[product][19] == 1}checked{/if}/> <span class="lbl"></span></label>{if $product[product][19] == 0}<input type="hidden" id="matma_hidden_{$product[product][0]}_{$contract[contract][0]}" name="matma[]" value="0" />{/if}</span>
																</td>
																<td align="left">
																	<span class="inline">
																		Số màu: 
																		<select name="color[]">
																			{for $foo=1 to 10}
																			<option value="{$foo}" {if $product[product][9] == $foo}selected{/if}>{$foo}</option>
																			{/for}
																		</select> màu
																	</span>
																	<br>
																	<span class="inline">
																		Ruột:
																		<select name="bowel[]">
																			<option value="baibang" {if $product[product][10] == 'Bãi Bằng'}selected{/if}>Bãi Bằng</option>
																			<option value="cacbon" {if $product[product][10] == 'Cacbon'}selected{/if}>Cacbon</option>
																			<option value="offset" {if $product[product][10] == 'Offset'}selected{/if}>Offset</option>
																		</select>
																	</span>
																	<br>
																	<span class="inline">Kích thước: <input type="text" name="size[]" value="{$product[product][11]}" size="10"></span>
																</td>
																<td align="center">
																	<select name="unit[]">
																		<option value="quyen50" {if $product[product][22] == 'quyen50'}selected="selected"{/if}>Quyển(50 số)</option>
																		<option value="quyen100" {if $product[product][22] == 'quyen100'}selected{/if}>Quyển(100 số)</option>
																		<option value="so" {if $product[product][22] == 'so'}selected{/if}>Số</option>
																		<option value="thung" {if $product[product][22] == 'thung'}selected{/if}>Thùng</option>
																		<option value="to" {if $product[product][22] == 'to'}selected{/if}>Tờ</option>
																	</select>
																</td>
																<td align="center"><input id="quantity_{$product[product][0]}_{$contract[contract][0]}" type="text" name="quantity[]" class="money" value="{$product[product][4]}" size="5" style="text-align:right"></td>
																<td align="center"><input id="quantity_t_{$product[product][0]}_{$contract[contract][0]}" type="text" name="quantity_t[]" value="{$product[product][15]}" size="6" style="text-align:right"></td>
																<td align="center"><input id="quantity_d_{$product[product][0]}_{$contract[contract][0]}" type="text" name="quantity_d[]" value="{$product[product][16]}" size="6" style="text-align:right"></td>
																<td align="center"><input id="price_{$product[product][0]}_{$contract[contract][0]}" type="text" name="price[]" class="money" value="{$product[product][8]}" size="10" style="text-align:right"></td>
															</tr>
															{/if}
															{/section}
														</tbody>
													</table>
													<br>
													<table border="0" width="100%">
														<tbody>
															<tr>
																<td align="left">
																	<input class="btn btn-sm btn-primary" id="addmore_{$contract[contract][0]}" type="button" value="Thêm sản phẩm">
																</td>
																<td align="right">
																	<input class="btn btn-sm btn-primary" type="button" id="submit_edit_{$contract[contract][0]}" name="submit" value="Cập nhật">&nbsp;
																	<input class="btn btn-sm btn-primary" type="button" value="Hủy bỏ" id="close_{$contract[contract][0]}">
																</td>
															</tr>
														</tbody>
													</table>
													</form>
												</div>
												{/section}
												{include file="templates/script.tpl" menu="contract_list"}
